package com.bac.rentmap.ad.crawler.stepped.predicate;

import com.bac.rentmap.ad.crawler.CrawledAd;

public class CountRestrictingRelevancePredicate<T extends CrawledAd> implements
		RelevancePredicate<T> {
	private int maxCount;
	private int count;

	public CountRestrictingRelevancePredicate(int maxCount) {
		this.maxCount = maxCount;
	}

	public boolean isRelevant(T crawledAd) {
		if (count >= maxCount)
			return false;
		count++;
		return true;
	}

}
